package sit.engreal.leetcode.problems300;

/**
 * <a href="https://leetcode.cn/problems/move-zeroes/">283. 移动零</a>
 */
public class LeetCode283 {
    public static class Solution {
        public void moveZeroes(int[] nums) {
            int i = 0;
            int j = 0;
            while (j < nums.length) {
                if (nums[j] != 0) {
                    nums[i] = nums[j];
                    i++;
                }
                j++;
            }
            while (i < nums.length) {
                nums[i] = 0;
            }
        }
    }

    public static void main(String[] args) {
        final Solution solution = new Solution();
    }
}
